#!/bin/bash
# encoding: utf-8

Proxy_IP=192.168.2.104
Proxy_Port=7890

# Set System Proxy
function xyon(){
    export https_proxy=http://$Proxy_IP:$Proxy_Port
    export http_proxy=http://$Proxy_IP:$Proxy_Port
    export all_proxy=socks5://$Proxy_IP:$Proxy_Port
    echo -e "System Proxy is $Proxy_IP:$Proxy_Port"
}

# unSet System Proxy
function xyoff(){
    unset all_proxy
    unset https_proxy
    unset http_proxy
    echo -e "System Proxy is Disabled"
}

# Default Function is Set Proxy
if [ $# != 0 ]
then
	if [ $1 == 'off' ]
	then
		xyoff
	elif [ $1 == 'on' ]
	then
		xyon
	else
		echo "Please Input on or off!"
	fi
else
	echo "Please input command."
fi